package com.aurora.base.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;

import javax.servlet.http.HttpServletRequest;

public class GetUrlJson {

	public static String getJson(HttpServletRequest request, String fileName) {
		String ctxpath = request.getSession().getServletContext()
				.getRealPath("/")
				+ "json/" + fileName;
		File file = new File(ctxpath);
		BufferedReader br = null;
		try {

			br = new BufferedReader(new InputStreamReader(new FileInputStream(
					file), "utf-8"));
			String temp = null;
			StringBuffer sb = new StringBuffer();
			temp = br.readLine();
			while (temp != null) {
				sb.append(temp);
				temp = br.readLine();
			}
			return sb.toString();
		} catch (Exception e) {
			return "";
		} finally {
			try {
				if (br != null)
					br.close();
			} catch (Exception e2) {
			}
		}
	}
}
